home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr04 / edv340.zip / LDVGAFNT.ASM < prev    next >
Assembly Source File  |  1989-02-08  |  2KB  |  109 lines

  1. ;    LDVGAFNT.COM
  2.  
  3. ;    Program to load a Hercules 4K RamFont font file
  4. ;    into the VGA user font.
  5.  
  6.  
  7. .radix    16
  8.  
  9.  
  10. lf    equ    0A
  11. cr    equ    0Dh
  12. term    equ    '$'
  13.  
  14.  
  15. code    segment
  16.     org    100
  17.     assume    cs:code, ds:code, es:code
  18.  
  19. Begin:
  20.  
  21.     jmp    Start
  22.  
  23. NoFileMsg    db    'Please specify a filename',cr,lf,term
  24. NoLoadMsg    db    'Can''t LOAD '
  25. FileName    db    90d    dup    (?)
  26. FontBuff    db    1000    dup    (?)
  27.  
  28. Start:
  29.  
  30.     push    cs        ; Make sure that all segments are the same
  31.     push    cs
  32.     pop    ds
  33.     pop    es
  34.  
  35.     mov    si, 0080    ; Look at command line count
  36.     lodsb
  37.     cmp    al, 0        ; If no command line, then Exit
  38.     je    NoFile
  39.     xor    cx, cx        ; Otherwise get command line count
  40.     mov    cl, al
  41.  
  42. SkipSpaces:
  43.     lodsb            ; Get a command line character
  44.     cmp    al, ' '        ; Skip over any spaces
  45.     jne    CopyFileName
  46.     dec    cx
  47.     jmp    SkipSpaces
  48.  
  49. CopyFileName:
  50.     dec    si        ; We've found the start of the filename
  51.     lea    di, FileName    ; Copy it to our FileName buffer
  52.     rep    movsb
  53.     mov    al, 0        ; ASCIIZ terminator
  54.     stosb
  55.  
  56.     lea    dx, FileName    ; Try to OPEN the font file
  57.     mov    ax, 3D00
  58.     int    21
  59.     jc    NoLoad        ; If carry is set, then there's trouble
  60.     mov    bx, ax        ; Otherwise save the handle
  61.  
  62.     lea    dx, FontBuff    ; Point to our font buffer
  63.     mov    cx, 1000    ; 4K to LOAD
  64.     mov    ah, 3F        ; LOAD it
  65.     int    21
  66.  
  67.     mov    ah, 3E        ; CLOSE the font file
  68.     int    21
  69.  
  70.     mov    ax, 1100    ; Load user font area 0
  71.     mov    bx, 1000    ; Sixteen bytes per character
  72.     mov    cx, 256d    ; All 256 characters to load
  73.     mov    dx, 0        ; Starting at offset 0
  74.     lea    bp, FontBuff    ; Point to the font buffer
  75.     int    10        ; Do it
  76.  
  77. GetOut:
  78.     mov    ax, 4C00    ; Exit to DOS with no errors
  79.     int    21
  80.  
  81. NoFile:
  82.     mov    ax, 0003    ; Reset VGA card
  83.     int    10        ; Do it
  84.  
  85.     lea    dx, NoFileMsg    ; Give our condolances
  86.     mov    ah, 9
  87.     int    21
  88.     jmp    GetOut
  89.  
  90. NoLoad:
  91.     mov    ax, 0003    ; Reset VGA card
  92.     int    10        ; Do it
  93.  
  94.     dec    di        ; Fix the COPIED filename
  95.     mov    al, cr        ; so that DOS will print it
  96.     stosb
  97.     mov    al, lf
  98.     stosb
  99.     mov    al, term
  100.     stosb
  101.     lea    dx, NoLoadMsg
  102.     mov    ah, 9
  103.     int    21
  104.     jmp    GetOut
  105.  
  106. code    ends
  107.  
  108. End    Begin
  109.